Skip to content

fix: reduce CPU/RAM on app launch with 10 performance fixes#177

Merged
datlechin merged 1 commit intomainfrom
fix/launch-performance-fixes
Mar 5, 2026
Merged

fix: reduce CPU/RAM on app launch with 10 performance fixes#177
datlechin merged 1 commit intomainfrom
fix/launch-performance-fixes

Conversation

@datlechin
Copy link
Owner

Summary

Fixes #175. Addresses high CPU/RAM on app launch with 10 targeted performance fixes across 9 source files.

  • RowProvider cache eviction: Replace O(n log n) sorted with O(n) filter in both InMemoryRowProvider and DatabaseRowProvider
  • String indexing: Replace O(n) string.index(offsetBy:) with O(1) NSString.substring in GeometryWKBParser (3 methods), RedisDriver INFO parsing
  • Autocomplete scoring: Replace O(n) label.count with O(1) NSString.length; hoist references.count out of inner loop in SQLSchemaProvider
  • AppDelegate retry loops: Replace 5×200ms and 10×50ms polling loops with targeted delayed checks
  • Storage init: Make QueryHistoryStorage.init non-blocking (queue.async); move TabStateStorage migration off main thread
  • Health monitor stagger: Add 0–10s random initial delay to prevent all monitors pinging simultaneously at launch

Test plan

  • Added 2 tests for RowProvider eviction correctness (closest rows retained, multi-cycle integrity)
  • Added 1 test for shorter label scoring in SQLCompletionProvider
  • Added 2 tests for allColumnsInScope prefix behavior in SQLSchemaProvider
  • Added 1 test for staggered initial delay in ConnectionHealthMonitor
  • All new tests pass
  • Full build succeeds
  • swiftlint lint --strict — 0 violations

@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@datlechin datlechin merged commit feb97bb into main Mar 5, 2026
1 check passed
@datlechin datlechin deleted the fix/launch-performance-fixes branch March 5, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: performances

1 participant